home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / X-Menu 2.0 / CustomView.m < prev    next >
Encoding:
Text File  |  2001-06-23  |  596 b   |  32 lines

  1. #import "CustomView.h"
  2.  
  3. @implementation CustomView
  4.  
  5. -(void)awakeFromNib
  6. {
  7.     regularImage = [NSImage imageNamed:@"apple"];
  8.     selectedImage = [NSImage imageNamed:@"selected"];
  9.  
  10.     [self setNeedsDisplay:YES];
  11. }
  12.  
  13. -(void)drawRect:(NSRect)rect
  14. {
  15.     [[NSColor clearColor] set];
  16.     NSRectFill([self frame]);
  17.  
  18.     if (isSelected==NO)
  19.         [regularImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
  20.     else
  21.         [selectedImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
  22. }
  23.  
  24. - (void)setIsSelected:(BOOL)flag
  25. {
  26.     isSelected = flag;
  27.     [self setNeedsDisplay:YES];
  28. }
  29.  
  30.  
  31. @end
  32.